import * as React from "react";
import { Button, Input } from "antd";
import "./index.less";

export interface SearchProps {
  onSubmit: (data: SearchState) => any;
}

export interface SearchState {
  likeStr: string;
}

class Search extends React.Component<SearchProps, SearchState> {
  state = {
    likeStr: "",
  };
  render() {
    let { likeStr } = this.state;
    return (
      <div className="Search rowcon_body">
        <span style={{ paddingLeft: 26 }}>设备名称：</span>
        <div className="d_inlineFlex">
          <Input
            value={likeStr}
            onChange={(e: any) => {
              this.setState({ likeStr: e.target.value });
            }}
          />
        </div>
        {/* <div className="d_inlineFlex" style={{ paddingLeft: 16 }}>
          <Button
            onClick={() => {
              this.onclear();
            }}
          >
            重置
          </Button>
        </div> */}
        <div className="d_inlineFlex" style={{ paddingLeft: 16 }}>
          <Button
            type="primary"
            onClick={() => {
              this.submit();
            }}
          >
            查询
          </Button>
        </div>
      </div>
    );
  }
  onclear() {
    this.setState({
      likeStr: "",
    });
  }
  submit() {
    this.props.onSubmit(this.state);
  }
}

export default Search;
